package com.xiangpq.pattern.creationalPatterns.factoryPattern;

import java.util.Objects;

/**
 * @author XPQ
 * @function
 * @since 2024-04-01
 */
public class ShapeFactory {

    public Shape getShape(String shapeName) {
        if (Objects.isNull(shapeName)) {
            return null;
        }
        if (shapeName.equalsIgnoreCase("CIRCLE")) {
            return new Circle();
        } else if (shapeName.equalsIgnoreCase("RECTANGLE")) {
            return new Rectangle();
        } else if (shapeName.equalsIgnoreCase("SQUARE")) {
            return new Square();
        }
        return null;
    }

}
